from django.db import models

# Create your models here.


class Contacts(models.Model):
    first_name = models.CharField(maxlength=20)
    last_name = models.CharField(maxlength=20)
    address = models.CharField(maxlength=200)
    suburb = models.CharField(maxlength=40)
    state = models.USStateField()
    country = models.CharField(maxlength=40)
    homephone = models.PhoneNumberField()
    workphone = models.PhoneNumberField()
    mobile = models.PhoneNumberField()
    email = models.EmailField()
    #date_entered = models.DateTimeField('date entered')   
    class Admin:
        pass
    
#Provides details about an individual computer 
class Computer(models.Model):
    computer_cbvid = models.AutoField(primary_key=True)
    computer_modeltype = models.CharField(maxlength=50)
    computer_distroversion = models.CharField(maxlength=50)
    computer_status = models.CharField(maxlength=50)
    computer_description = models.CharField(maxlength=50)#not in final version
 
# records a sale of anything noteworthy as well as a computer    
class Sales(models.Model):
    sales_id = models.AutoField(primary_key=True)
    sales_contact_id = models.ForeignKey(Contacts)
    sales_cbv_no = models.ForeignKey(Computer) 
    #May possible be blank as not all sales will be of computers and there for hacve a cbv number
    #I now suspect that this should be an integer field
    sales_price = models.IntegerField()
    sales_date = models.DateField() #Possibly auto now?
    sales_salesperson = models.CharField(maxlength=50)
   

 
#Provides details about a class of computer ie basis, standar or upgrade   
class Computer_class(models.Model):
    computer_classid = models.AutoField(primary_key=True)
    computer_modeltype = models.CharField(maxlength=50)
    computer_distroversion = models.CharField(maxlength=50)
    computer_status = models.CharField(maxlength=50)
    computer_description = models.CharField(maxlength=50)#not in final version
    ## Give the computer_class model an "Admin Interface" so that staff users 
    ## can add new classses of computer if they wish.
    class Admin:
        pass
 
#Lists the componets that go into a computer or class of computer
class Computer_components(models.Model):
    component_id = models.AutoField(primary_key=True)
    componentclass = models.CharField(maxlength=50)
    componenttype = models.CharField(maxlength=50)
    component_price = models.CharField(maxlength=50)
    ## Give the computer_components model an "Admin Interface" so that staff users 
    ## can add new computer components if they wish.
    class Admin:
        pass